<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<title>ProjectFunction-ProjectManagment</title>
	<meta content='width=device-width, initial-scale=1.0, shrink-to-fit=no' name='viewport'/>
	<link rel="icon" th:href="@{/assets/img/icon.ico}" type="image/x-icon"/>
	<div th:replace="commom/bar :: commom_css"></div>
	<link rel="stylesheet" th:href="@{/assets/js/bootstrap-datepicker-master/css/bootstrap-datepicker3.standalone.css}">
</head>
<body>
<div class="wrapper">
	<div th:replace="commom/bar :: topbar"></div>
	<!-- Sidebar -->
	<div th:replace="commom/bar :: projectsidebar"></div>
	<!-- End Sidebar -->

	<div class="main-panel">
		<div class="content">
			<div class="page-inner">
				<div class="page-header col-md-6">
					<h4 class="page-title">[[${project.name}]]功能点</h4>
					<ul class="breadcrumbs">
						<li class="nav-home">
							<a th:href="@{/}">
								<i class="flaticon-home"></i>
							</a>
						</li>
						<li class="separator">
							<i class="flaticon-right-arrow"></i>
						</li>
						<li class="nav-item">
							<a th:href="@{/projects_view/{id}(id=${project.id})}">项目主面板</a>
						</li>
						<li class="separator">
							<i class="flaticon-right-arrow"></i>
						</li>
						<li class="nav-item">
							<a th:href="@{/project_function_view/{id}(id=${project.id})}">项目功能点</a>
						</li>
					</ul>
				</div>
				<!--功能点概览-->
				<div class="row">
					<div style="width: 19%;float: left">
						<div class="card card-stats card-round">
							<div class="card-body ">
								<div class="row">
									<div class="col-5">
										<div class="icon-big text-center">
											<i class="fas fa-battery-empty text-warning"></i>
										</div>
									</div>
									<div class="col col-stats">
										<div class="numbers">
											<p class="card-category">待办功能点</p>
											<h4 class="card-title" id="projectFunctionTodo"></h4>

										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div style="width: 1%;float: left">&nbsp;</div>
					<div style="width: 19%;float: left">
						<div class="card card-stats card-round">
							<div class="card-body ">
								<div class="row">
									<div class="col-5">
										<div class="icon-big text-center">
											<i class="fas fa-battery-half text-primary"></i>
										</div>
									</div>
									<div class="col col-stats">
										<div class="numbers">
											<p class="card-category">进行中功能点</p>
											<h4 class="card-title" id="projectFunctionProcesing"></h4>

										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div style="width: 1%;float: left">&nbsp;</div>
					<div style="width: 19%;float: left">
						<div class="card card-stats card-round">
							<div class="card-body">
								<div class="row">
									<div class="col-5">
										<div class="icon-big text-center">
											<i class="fas fa-battery-three-quarters text-secondary"></i>
										</div>
									</div>
									<div class="col col-stats">
										<div class="numbers">
											<p class="card-category">已完成功能点</p>
											<h4 class="card-title" id="projectFunctionCompleted"></h4>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div style="width: 1%;float: left">&nbsp;</div>
					<div style="width: 19%;float: left">
						<div class="card card-stats card-round">
							<div class="card-body">
								<div class="row">
									<div class="col-5">
										<div class="icon-big text-center">
											<i class="fas fa-battery-full text-success"></i>
										</div>
									</div>
									<div class="col col-stats">
										<div class="numbers">
											<p class="card-category">已验收功能点</p>
											<h4 class="card-title" id="projectFunctionAccepted"></h4>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div style="width: 1%;float: left">&nbsp;</div>
					<div style="width: 19%;float: left">
						<div class="card card-stats card-round">
							<div class="card-body">
								<div class="row">
									<div class="col-5">
										<div class="icon-big text-center">
											<i class="fas fa-broom" style="color: #7B7687"></i>
										</div>
									</div>
									<div class="col col-stats">
										<div class="numbers">
											<p class="card-category">已取消功能点</p>
											<h4 class="card-title" id="projectFunctionCancel"></h4>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--功能点详情-->
				<div class="row">
					<div class="col-md-2 card" style="height: 700px;">
						<div class="card-header">
							<h2 style="margin-top: 10px" class="text-center">功能</h2>
						</div>
						<div class="card-body">
							<!--进度条-->
							<div id="function-complete" class="chart-circle mt-4 mb-3"></div>
							<div class="nav flex-column nav-pills nav-secondary" id="v-pills-tab" role="tablist"
							     aria-orientation="vertical" style="margin-top: 20px">
								<a class="nav-link active" data-toggle="pill" href="#"
								   onclick="allFunctionPage()"><i class="fas fa-layer-group"></i>全部功能</a>
								<a class="nav-link" data-toggle="pill" href="#" onclick="assignFunctionPage()">指派给我的</a>
								<a class="nav-link" data-toggle="pill" href="#" onclick="publishFunctionPage()">我发布的</a>
								<a class="nav-link" data-toggle="pill" href="#" onclick="joinFunctionPage()">我参与的</a>
							</div>
							<br>
							<div class="text-center">
								<button class="btn btn-primary" onclick="addFunctionModel()">
                                                <span class="btn-label">
                                                    <i class="fas fa-plus"></i>
                                                </span>
									新建功能
								</button>
							</div>
							<br>
							<div class="text-center">
								<button class="btn btn-danger" onclick="delFunctionModel()">
                                                <span class="btn-label">
                                                    <i class="fas fa-times"></i>
                                                </span>
									删除功能
								</button>
							</div>
						</div>
					</div>
					<!--功能-->
					<div class="tab-content col-md-10" style="height: 630px;" id="v-pills-tabContent">
						<div class="tab-pane fade show active" id="v-pills-four" role="tabpanel"
						     aria-labelledby="v-pills-four-tab">
							<div style="width: 19%;float: left">
								<div class="card" style="height: 700px;">
									<div class="card-header"
									     style="background-color: rgba(245,232,200,0.5)">
										<div class="card-title" style="color: black">
											<i class="fas fa-battery-empty" style="color: #FF9933"></i>&nbsp;待办的
										</div>
									</div>
									<div class="card-body"
									     style="background-color: rgba(220,220,220,0.3)">
										<div style="margin-top: -15px">
											<!-- 分页容器：显示数据--参与 -->
											<div id="TodoDiv"></div>
										</div>
									</div>
									<div class="card-footer">
										<!-- 分页容器： 显示分页按钮-->
										<div class="text-center">
											<!-- 注意:3版本的分页容器标签是<ul>，2版本的容器标签是<div> -->
											<ul id="TodoFunctionPage"
											    class="pagination pagination-sm"></ul>
										</div>
									</div>
								</div>
							</div>
							<div style="width: 1%;float: left">&nbsp;</div>
							<div style="width: 19%;float: left">
								<div class="card" style="height: 700px;">
									<div class="card-header"
									     style="background-color: rgba(157,211,250,0.5)">
										<div class="card-title" style="color: black">
											<i class="fas fa-battery-half" style="color: #1F6FB5"></i>&nbsp;进行中
										</div>
									</div>
									<div class="card-body"
									     style="background-color: rgba(220,220,220,0.3)">
										<div style="margin-top: -15px">
											<!-- 分页容器：显示数据 -->
											<div id="ProcesingDiv"></div>
										</div>
									</div>
									<div class="card-footer">
										<!-- 分页容器： 显示分页按钮-->
										<div class="text-center">
											<!-- 注意:3版本的分页容器标签是<ul>，2版本的容器标签是<div> -->
											<ul id="ProcesingFunctionPage"
											    class="pagination pagination-sm"></ul>
										</div>
									</div>
								</div>
							</div>
							<div style="width: 1%;float: left">&nbsp;</div>
							<div style="width: 19%;float: left">
								<div class="card" style="height: 700px;">
									<div class="card-header"
									     style="background-color: rgba(118,126,199,0.5)">
										<div class="card-title" style="color: black"><i
												class="fas fa-battery-three-quarters"
												style="color: #795DDE"></i>&nbsp;已完成
										</div>
									</div>
									<div class="card-body"
									     style="background-color: rgba(220,220,220,0.3)">
										<div style="margin-top: -15px">
											<!-- 分页容器：显示数据 -->
											<div id="CompletedDiv"></div>
										</div>
									</div>
									<div class="card-footer">
										<!-- 分页容器： 显示分页按钮-->
										<div class="text-center">
											<!-- 注意:3版本的分页容器标签是<ul>，2版本的容器标签是<div> -->
											<ul id="CompletedFunctionPage"
											    class="pagination pagination-sm"></ul>
										</div>
									</div>
								</div>
							</div>
							<div style="width: 1%;float: left">&nbsp;</div>
							<div style="width: 19%;float: left">
								<div class="card" style="height: 700px;">
									<div class="card-header"
									     style="background-color: rgba(25,148,117,0.5)">
										<div class="card-title" style="color: black"><i
												class="fas fa-battery-full"
												style="color: #007850"></i>&nbsp;已验收
										</div>
									</div>
									<div class="card-body"
									     style="background-color: rgba(220,220,220,0.3)">
										<div style="margin-top: -15px">
											<!-- 分页容器：显示数据 -->
											<div id="AcceptedDiv"></div>
										</div>
									</div>
									<div class="card-footer">
										<!-- 分页容器： 显示分页按钮-->
										<div class="text-center">
											<!-- 注意:3版本的分页容器标签是<ul>，2版本的容器标签是<div> -->
											<ul id="AcceptedFunctionPage"
											    class="pagination pagination-sm"></ul>
										</div>
									</div>
								</div>
							</div>
							<div style="width: 1%;float: left">&nbsp;</div>
							<div style="width: 19%;float: left">
								<div class="card" style="height: 700px;">
									<div class="card-header"
									     style="background-color: rgba(172,173,172,0.5)">
										<div class="card-title" style="color: black"><i
												class="fas fa-broom"
												style="color: #7B7687"></i>&nbsp;已取消
										</div>
									</div>
									<div class="card-body"
									     style="background-color: rgba(220,220,220,0.3)">
										<div style="margin-top: -15px">
											<!-- 分页容器：显示数据 -->
											<div id="CancelDiv"></div>
										</div>
									</div>
									<div class="card-footer">
										<!-- 分页容器： 显示分页按钮-->
										<div class="text-center">
											<!-- 注意:3版本的分页容器标签是<ul>，2版本的容器标签是<div> -->
											<ul id="CancelFunctionPage"
											    class="pagination pagination-sm"></ul>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<!--model框-->
<div th:replace="commom/bar :: uploadfilemodel"></div>
<div th:replace="commom/bar :: newprojectpackage"></div>
<!--添加功能弹出框-->
<div class="modal fade" id="addFunction" tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title">
                        <span class="fw-mediumbold">
                            新建功能</span>
				</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<div class="modal-body">
				<div class="row">
					<div class="col-md-6 pr-0">
						<div class="form-group">
							<label for="addName">功能名</label>
							<input id="addName" name="functionName" type="text" class="form-control" autocomplete="off"
							       onBlur="checkFunctionName()">
							<span class="default" style="color: #3c763d" id="nameErr">请输入功能名称</span>
						</div>
					</div>
					<div class="col-md-6 pr-0">
						<div class="form-group">
							<label for="addRealizeUserId">实现用户</label>
							<select name="realizeUserId" id="addRealizeUserId" class="form-control"></select>
						</div>
					</div>
					<div class="col-md-12">
						<div class="form-group">
							<label for="plannedStartTime">计划开始时间</label>
							<input type="text" name="plannedStartTime" id="plannedStartTime" class="form-control"
							       autocomplete="off">
						</div>
					</div>
					<div class="col-md-12">
						<div class="form-group">
							<label for="plannedEndTime">计划结束时间</label>
							<input type="text" name="plannedEndTime" id="plannedEndTime" class="form-control"
							       autocomplete="off">
						</div>
					</div>
					<div class="col-md-12">
						<div class="form-group">
							<label for="description">功能描述</label>
							<textarea type="text" class="form-control" name="description" id="description"
							          autocomplete="off"></textarea>
						</div>

					</div>
				</div>
			</div>
			<div class="modal-footer no-bd">
				<button type="button" class="btn btn-primary" onclick="addFunction()">Add</button>
				<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
			</div>
		</div>
	</div>
</div>
<!--删除功能弹出框-->
<div class="modal fade" id="delFunction" tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title">
                        <span class="fw-mediumbold">
                            删除功能</span>
				</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<div class="modal-body">
				<div class="row">
					<div class="col-md-6 pr-0">
						<div class="form-group form-group-default">
							<label>功能名</label>
							<select name="functionName" id="functionName" class="form-control">
							</select>
						</div>
					</div>
					<div class="col-md-6 pr-0">
						<div class="form-group form-group-default">
							<label>删除原因</label>
							<input id="delReason" type="text" class="form-control" required>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer no-bd">
				<button type="button" class="btn btn-primary" onclick="deleteProjectFunction()">确定</button>
				<button type="button" class="btn btn-danger" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>


<!--公共JS-->
<th:block th:replace="commom/bar :: commom_js"/>
<!--公共JS-->
<th:block th:replace="commom/bar :: nav_project_js"/>
<!--日期选择器-->
<script th:src="@{/assets/js/bootstrap-datepicker-master/js/bootstrap-datepicker.min.js}"></script>
<script th:src="@{/assets/js/bootstrap-datepicker-master/locales/bootstrap-datepicker.zh-CN.min.js}"></script>

<!--功能点分页-->
<script type="text/javascript">
    var functionStatusFlag = 0;
    $(function () {
        allFunctionPage();
    })

    //全部功能点
    function allFunctionPage() {
        functionStatusFlag = 0;
        var allFunctionUrl = "/allFunctionPage";
        appendFuntion1(projectId, allFunctionUrl);
    }

    //分配给我的功能点
    function assignFunctionPage() {
        functionStatusFlag = 1;
        var assignFunctionUrl = "/assignFunctionPage";
        appendFuntion2(projectId, userId, assignFunctionUrl);
    }

    //我发布的功能点
    function publishFunctionPage() {
        functionStatusFlag = 2;
        var publishFunctionUrl = "/publishFunctionPage";
        appendFuntion2(projectId, userId, publishFunctionUrl);
    }

    //正在进行的功能点
    function joinFunctionPage() {
        functionStatusFlag = 3;
        var joinFunctionUrl = "/joinFunctionPage";
        appendFuntion2(projectId, userId, joinFunctionUrl);
    }

    //提取
    function appendFuntion1(projectId, url) {
        var functionPage = $('#TodoFunctionPage');
        var divName = $('#TodoDiv');
        $(divName).html("");
        var pagecolor = "#FF9933";
        var functionStatus = 0;
        functionPageStart(url, projectId, functionStatus, functionPage, divName, pagecolor);//全部功能-待办

        var functionPage2 = $('#ProcesingFunctionPage');
        var divName2 = $('#ProcesingDiv');
        $(divName2).html("");
        var pagecolor2 = "#1F6FB5";
        var functionStatus2 = 1;
        functionPageStart(url, projectId, functionStatus2, functionPage2, divName2, pagecolor2);//全部功能-进行

        var functionPage3 = $('#CompletedFunctionPage');
        var divName3 = $('#CompletedDiv');
        $(divName3).html("");
        var pagecolor3 = "#795DDE";
        var functionStatus3 = 2;
        functionPageStart(url, projectId, functionStatus3, functionPage3, divName3, pagecolor3);//全部功能-完成

        var functionPage4 = $('#AcceptedFunctionPage');
        var divName4 = $('#AcceptedDiv');
        $(divName4).html("");
        var pagecolor4 = "#007850";
        var functionStatus4 = 3;
        functionPageStart(url, projectId, functionStatus4, functionPage4, divName4, pagecolor4);//全部功能-已验收

        var functionPage5 = $('#CancelFunctionPage');
        var divName5 = $('#CancelDiv');
        $(divName5).html("");
        var pagecolor5 = "#7B7687";
        var functionStatus5 = 4;
        functionPageStart(url, projectId, functionStatus5, functionPage5, divName5, pagecolor5);//全部功能-已取消
    }

    function appendFuntion2(projectId, userId, url) {
        var functionPage = $('#TodoFunctionPage');
        var divName = $('#TodoDiv');
        $(divName).html("");
        var pagecolor = "#FF9933";
        var functionStatus = 0;
        functionPageStart2(url, projectId, userId, functionStatus, functionPage, divName, pagecolor);//全部功能-待办

        var functionPage2 = $('#ProcesingFunctionPage');
        var divName2 = $('#ProcesingDiv');
        $(divName2).html("");
        var pagecolor2 = "#1F6FB5";
        var functionStatus2 = 1;
        functionPageStart2(url, projectId, userId, functionStatus2, functionPage2, divName2, pagecolor2);//全部功能-进行

        var functionPage3 = $('#CompletedFunctionPage');
        var divName3 = $('#CompletedDiv');
        $(divName3).html("");
        var pagecolor3 = "#795DDE";
        var functionStatus3 = 2;
        functionPageStart2(url, projectId, userId, functionStatus3, functionPage3, divName3, pagecolor3);//全部功能-完成

        var functionPage4 = $('#AcceptedFunctionPage');
        var divName4 = $('#AcceptedDiv');
        $(divName2).html("");
        var pagecolor4 = "#007850";
        var functionStatus4 = 3;
        functionPageStart2(url, projectId, userId, functionStatus4, functionPage4, divName4, pagecolor4);//全部功能-已验收

        var functionPage5 = $('#CancelFunctionPage');
        var divName5 = $('#CancelDiv');
        $(divName5).html("");
        var pagecolor5 = "#7B7687";
        var functionStatus5 = 4;
        functionPageStart2(url, projectId, userId, functionStatus5, functionPage5, divName5, pagecolor5);//全部功能-已取消
    }


</script>
<!--功能点进度条-->
<script type="text/javascript">
    $(function () {
        getChart();
    })

    function getChart() {
        $.ajax({
            type: "get",
            url: "/projectFunctionDataCicleChart",
            dataType: "json",
            data: {
                projectId: projectId,
            },
            success: function (data) {
                Circles.create({
                    id: 'function-complete',
                    radius: 50,
                    value: data,
                    maxValue: 100,
                    width: 10,
                    text: function (value) {
                        return value + '%';
                    },
                    colors: ['#EACF02', '#2E68AA'],
                    duration: 400,
                    wrpClass: 'circles-wrp',
                    textClass: 'circles-text',
                    styleWrapper: true,
                    styleText: true
                })
            }
        })
    }

    function refreshTodoFunction(projectId) {
        var functionPage = $('#TodoFunctionPage');
        var divName = $('#TodoDiv');
        $(divName).html("");
        var pagecolor = "#FF9933";
        var functionStatus = 0;
        $(divName).html("");
        if (functionStatusFlag == 0) {
            var url = "/allFunctionPage";
            functionPageStart(url, projectId, functionStatus, functionPage, divName, pagecolor);//全部功能-待办
        } else {
            if (functionStatusFlag == 1) {
                var url = "/assignFunctionPage";
            } else if (functionStatusFlag == 2) {
                var url = "/publishFunctionPage";
            } else if (functionStatusFlag == 3) {
                var url = "/joinFunctionPage";
            }
            functionPageStart2(url, projectId, userId, functionStatus, functionPage, divName, pagecolor);//全部功能-待办
        }

    }

    //添加项目功能
    function addFunction() {
        var functionName = $("#addName").val();
        var realizeUserId = $("#addRealizeUserId").val();
        var plannedStartTime = $("#plannedStartTime").val();
        var plannedEndTime = $("#plannedEndTime").val();
        var description = $("#description").val();
        var projectsId = projectId;
        var publishUserId = userId;
        if (!checkAddFunction()) {
            return;
        } else {
            $.ajax(
                {
                    type: "POST",
                    url: "/add_project_function",
                    data: {
                        projectsId: projectsId,
                        functionName: functionName,
                        realizeUserId: realizeUserId,
                        publishUserId: publishUserId,
                        plannedStartTime: plannedStartTime,
                        plannedEndTime: plannedEndTime,
                        description: description
                    },
                    dataType: "json",
                    success: function (data) {
                        if (data == 1) {
                            swal("添加成功！", {
                                icon: "success",
                                buttons: false,
                                timer: 1500,
                            });
                            setTimeout(function () {
                                refreshTodoFunction(projectsId);
                                $('#addFunction').modal('hide');
                            }, 1500);
                        } else if (data == 6) {
                            swal("添加失败！", "功能点名称不能为空!", {
                                icon: "error",
                                buttons: {
                                    confirm: {
                                        className: 'btn btn-danger'
                                    }
                                }
                            })
                        } else {
                            swal("添加失败！", {
                                icon: "error",
                                buttons: {
                                    confirm: {
                                        className: 'btn btn-danger'
                                    }
                                }
                            })
                        }
                    }
                }
            );
        }
    }

</script>
<!--加载项目功能点数量-->
<script type="text/javascript">
    $(function () {
        functionNum();
    })

    function functionNum() {
        $.ajax({
            type: "get",
            url: "/projectFunctionTotal",
            dataType: "json",
            data: {
                projectId: projectId,
            },
            success: function (json) {
                $("#projectFunctionTodo").text(json.data0);
                $("#projectFunctionProcesing").text(json.data1);
                $("#projectFunctionCompleted").text(json.data2);
                $("#projectFunctionAccepted").text(json.data3);
                $("#projectFunctionCancel").text(json.data4);
            }
        })
    }
</script>
<!--新建项目弹出框-->
<script type="text/javascript">
    function addFunctionModel() {
        checkLoginAndPowerAndDoFunction(addFunctionDo, projectId)
    }

    function addFunctionDo(arguments) {
        $('#addFunction').modal('show');
        $.ajax({
            type: "Get",
            url: "/projectUsers",
            data: {
                projectId: arguments[1],
            },
            success: function (result) {
                addFunctionProjectUserAppendHtml(result)
            }
        })
    }

    //页面渲染
    function addFunctionProjectUserAppendHtml(list) {
        var tableShow = '';
        for (var i = 0; i < list.length; i++) {
            console.log(list[i])
            tableShow +=
                '<option value=' + list[i].myUserDetails.id + '>' + list[i].myUserDetails.username + '</option>\n'
        }
        $('#addRealizeUserId').html(tableShow)
    }
</script>
<!--删除功能弹出框-->
<script type="text/javascript">
    function delFunctionModel() {
        checkLoginAndPowerAndDoFunction(delFunctionDo, projectId, userId)
    }

    function delFunctionDo(arguments) {
        $('#delFunction').modal('show');
        $.ajax({
            type: "Get",
            url: "/project_function",
            data: {
                projectId: arguments[1],
                userId: arguments[2]
            },
            success: function (result) {
                projectFunctionAppendHtml(result.data);
                $('#delFunction').modal('hide');
            }
        })
    }

    //页面渲染
    function projectFunctionAppendHtml(list) {//此函数用于处理后台返回的数据，根据自己需求来实现页面拼接
        var tableShow = '';
        for (var i = 0; i < list.length; i++) {
            tableShow +=
                '<option value=' + list[i].id + '>' + list[i].functionName + '</option>\n'
        }
        $('#functionName').html(tableShow)
    }

    //删除功能
    function deleteProjectFunction() {
        var id = $("#functionName").val();
        var reason = $("#delReason").val();
        if (reason.length == 0) {
            swal({
                icon: "warning",
                title: "删除原因不能为空！",
                text: "请输入！",
                type: "warning",
                buttons: false,
                timer: 1500,
            })
        } else {
            swal({
                icon: "warning",
                title: "您确定要删除该功能吗?",
                text: "请谨慎操作！",
                type: "warning",
                buttons: {
                    cancel: {
                        visible: true,
                        text: '取消',
                        className: 'btn btn-danger'
                    },
                    confirm: {
                        text: '确定删除',
                        className: 'btn btn-success'
                    }
                },
                closeOnConfirm: false,
            }).then(
                function (isConfirm) {
                    if (!isConfirm) return;
                    $.ajax(
                        {
                            type: "POST",
                            url: "/del_project_function",
                            data: {
                                id: id,
                                reason: reason
                            },
                            dataType: "json",
                            success: function (data) {
                                if (data) {
                                    swal("删除成功！", {
                                        icon: "success",
                                        buttons: false,
                                        timer: 1500,
                                    });
                                    setTimeout(function () {
                                        allFunctionPage();
                                        assignFunctionPage();
                                        publishFunctionPage();
                                        joinFunctionPage();
                                        delFunction();
                                        functionNum();
                                        getChart();
                                    }, 1500);
                                } else {
                                    swal("删除失败！", {
                                        icon: "error",
                                        buttons: {
                                            confirm: {
                                                className: 'btn btn-danger'
                                            }
                                        }
                                    })
                                }
                            }
                        }
                    );
                }
            );
        }
    }
</script>

<!--时间插件-->
<script type="text/javascript">
    $('#plannedStartTime').datepicker({
        format: 'yyyy/mm/dd',
        language: "zh-CN"
    })
    $('#plannedEndTime').datepicker({
        format: 'yyyy/mm/dd',
        language: "zh-CN"
    })
</script>
<!--功能点详情-->
<script type="text/javascript">
    function projectFunctionDetail(projectFunctionId) {
        location.href = "/project_function_detail_view/" + projectFunctionId;
    }
</script>

</body>
</html>